package com.acctrue.zentao.enums;

/**
 * @author: 孙炯炯
 * @since: 2024/9/5
 **/
public enum ModuleTypeEnum {
    /**
     * 模块类型
     */
    BUG("bug", "bug"),
    TASK("task", "任务"),
    DOC("doc", "文档"),
    DEFAULT("default", "默认"),
    ;
    private final String value;
    private final String name;

    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    ModuleTypeEnum(String value, String name) {
        this.value = value;
        this.name = name;
    }

    public static String getCommitPrefix(ModuleTypeEnum moduleType, String taskType) {
        if (ModuleTypeEnum.BUG == moduleType) {
            return "fix:";
        }

        if (ModuleTypeEnum.TASK == moduleType) {
            return TaskTypeEnum.getGroupByValue(taskType) + ":";
        }
        if (ModuleTypeEnum.DEFAULT == moduleType) {
            return TaskTypeEnum.getGroupByValue(taskType) + ":";
        }
        return "";
    }
}
